package router

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"novel/hendel"
)

func Router() *gin.Engine {
	// 1.创建路由
	r := gin.Default()
	// 2.绑定路由规则，执行的函数
	// gin.Context，封装了request和response
	r.GET("/", func(c *gin.Context) {
		c.String(http.StatusOK, "hello World!")
	})
	r.POST("/login", hendel.Login)
	r.GET("/list", hendel.List)
	r.GET("/detail", hendel.Detail)
	return r
}
